function getPreviousDays(n) {
    const today = new Date(); // 当前日期
    const pastDate = new Date(today); // 复制当前日期
    pastDate.setDate(today.getDate() - n); // 计算 n 天前的日期

    // 格式化为 YYYY-MM-DD
    const year = pastDate.getFullYear();
    const month = String(pastDate.getMonth() + 1).padStart(2, '0');
    const day = String(pastDate.getDate()).padStart(2, '0');
    
    return `${year}-${month}-${day}`;
}
  
const formatDate = function () {
  const date = new Date();
  return date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate()
}
  module.exports = {
    getPreviousDays,
    formatDate
  }